﻿<r:RibbonWindow x:Class="VRacer.Controls.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:VRacer"
                xmlns:cmd="clr-namespace:VRacer.Controls.CommandsNS"
    xmlns:common="clr-namespace:VRacer;assembly=VRacer"
    xmlns:controls="clr-namespace:VRacer.Controls"
    xmlns:wpf="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    Title="Vector Racer" Height="600" Width="800"
                Icon="../Icons/logo-2.png">


    <Window.InputBindings>
        <KeyBinding Gesture="Alt+Enter" Command="cmd:MyRibbonCommands.CMD"/>
    </Window.InputBindings>

    <Window.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
            <GradientStop Offset="0" Color="#ffffff" />
            <GradientStop Offset="0.9" Color="#d0d0ee" />
            <GradientStop Offset="1" Color="#eeeeff" />
        </LinearGradientBrush>
    </Window.Background>

    <Window.Resources>

        <r:RibbonCommand x:Key="StartQuickGameCommand"
                         
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           Executed="RibbonCommand_StartQuickGame_Executed"
                           LabelTitle="New game"
                           LabelDescription="Choose game type"
                         LargeImageSource="../Icons/joystick.png"
                         SmallImageSource="../Icons/joystick.png"
                           ToolTipTitle="New game"
                           ToolTipDescription="Starts new quick game." />

        <r:RibbonCommand x:Key="StartLocalGameCommand"
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           LabelTitle="Multiplayer"
                           LabelDescription="Starts new local game with many players."
                         LargeImageSource="../Icons/multiplayer.png"
                         SmallImageSource="../Icons/multiplayer.png"
                           Executed="RibbonCommand_StartLocalGame_Executed"
                           ToolTipTitle="Multiplayer"
                           ToolTipDescription="Starts new game with many players." />

        <r:RibbonCommand x:Key="StartNetGameCommand"
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           LabelTitle="Internet"
                           LabelDescription="Starts new remote game."
                         LargeImageSource="../Icons/network.png"
                         SmallImageSource="../Icons/network.png"
                           Executed="RibbonCommand_StartNetGame_Executed"
                           ToolTipTitle="Internet"
                           ToolTipDescription="Starts new remote game." />

        <r:RibbonCommand x:Key="StartTutorialGameCommand"
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           LabelTitle="Tutorial"
                           LabelDescription="Starts new tutorial game in special mode with hints."
                         LargeImageSource="../Icons/tutorial.png"
                         SmallImageSource="../Icons/tutorial.png"
                           Executed="RibbonCommand_StartTutorialGame_Executed"
                           ToolTipTitle="Tutorial"
                           ToolTipDescription="Starts tutorial game." />

        <r:RibbonCommand x:Key="StartTrackEditorCommand"
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           LabelTitle="Editor"
                         LargeImageSource="../Icons/map_editor.png"
                         SmallImageSource="../Icons/map_editor.png"
                           Executed="RibbonCommand_StartTrackEditor_Executed"
                           ToolTipTitle="Track editor"
                           ToolTipDescription="Starts tutorial game." />

        <r:RibbonCommand x:Key="ShowHighscoresCommand"
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           LabelTitle="Highscores"
                           LabelDescription="Starts new local game with many players."
                         LargeImageSource="../Icons/games_highscores.png"
                         SmallImageSource="../Icons/games_highscores.png"
                           Executed="RibbonCommand_ShowHighscores_Executed"
                           ToolTipTitle="Multiplayer"
                           ToolTipDescription="Starts new game with many players." />

        <r:RibbonCommand x:Key="ShowInstructionsCommand"
                           CanExecute="RibbonCommand_StartGame_CanExecute"
                           LabelTitle="Instructions"
                         LargeImageSource="../Icons/book2.png"
                         SmallImageSource="../Icons/book2.png"
                           Executed="RibbonCommand_ShowInstructions_Executed"
                           ToolTipTitle="Instructions"
                           ToolTipDescription="Starts tutorial game." />




    </Window.Resources>

    <Grid>
        <DockPanel DataContext="{x:Static local:Business.Instance}">
            <r:Ribbon DockPanel.Dock="Top" Title="Vector Racer">
                <r:Ribbon.ApplicationMenu>
                    <r:RibbonApplicationMenu AlternationCount="2">
                        <r:RibbonApplicationMenu.Command>
                            <r:RibbonCommand ToolTipTitle="Vector Racer" ToolTipDescription="Remake of classic paper game Vector Racer" ToolTipFooterTitle="Authors" ToolTipFooterDescription="Paweł Pieniążek i Piotr Rojek Copyright 2009" ToolTipFooterImageSource="../Icons/logo_32.png" LabelTitle="Vector Racer" SmallImageSource="../Icons/logo_16.png">


                            </r:RibbonCommand>
                        </r:RibbonApplicationMenu.Command>

                        <r:RibbonApplicationSplitMenuItem StaysOpenOnClick="True" Command="{StaticResource StartQuickGameCommand}">
                            <r:RibbonApplicationMenuItem Command="{StaticResource StartLocalGameCommand}" />
                            <r:RibbonApplicationMenuItem Command="{StaticResource StartNetGameCommand}" />
                            <r:RibbonApplicationMenuItem Command="{StaticResource StartTutorialGameCommand}" />
                        </r:RibbonApplicationSplitMenuItem>
                        <r:RibbonSeparator />
                        <r:RibbonApplicationMenuItem Command="{StaticResource StartTrackEditorCommand}" />
                        <r:RibbonApplicationMenuItem Command="{StaticResource ShowHighscoresCommand}" />
                        <r:RibbonApplicationMenuItem Command="{StaticResource ShowInstructionsCommand}" />
                        <r:RibbonSeparator />
                        <r:RibbonApplicationMenuItem Command="cmd:MyRibbonCommands.CloseApp" />

                    </r:RibbonApplicationMenu>
                </r:Ribbon.ApplicationMenu>

                <r:Ribbon.QuickAccessToolBar>
                    <r:RibbonQuickAccessToolBar DockPanel.Dock="Top">
                        <r:RibbonButton Command="{StaticResource StartQuickGameCommand}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                        <r:RibbonButton Command="cmd:MyRibbonCommands.EndGame" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                    </r:RibbonQuickAccessToolBar>

                </r:Ribbon.QuickAccessToolBar>

                <r:Ribbon.ContextualTabGroups>
                    <r:RibbonContextualTabGroup Color="Red" Label="Game" IsActive="{Binding Game.IsEditable}" MinWidth="100">
                        <r:RibbonTab Label="Game" IsSelected="{Binding Game.IsEditable, Mode=OneWay}">
                            <r:RibbonGroup>
                                <r:RibbonGroup.Command>
                                    <r:RibbonCommand LabelTitle="State" />
                                </r:RibbonGroup.Command>

                                <r:RibbonButton Command="cmd:MyRibbonCommands.StartGame" />
                            </r:RibbonGroup>

                            <r:RibbonGroup>
                                <r:RibbonGroup.Command>
                                    <r:RibbonCommand LabelTitle="Configuration" />
                                </r:RibbonGroup.Command>

                                <r:RibbonButton Command="cmd:MyRibbonCommands.AddNewHumanPlayer" />
                                <r:RibbonButton Command="cmd:MyRibbonCommands.AddNewComputerPlayer" />

                                <r:RibbonTextBox Text="{Binding Source={x:Static local:Business.Instance}, Path=Game.Laps}">
                                    <r:RibbonTextBox.Command>
                                        <r:RibbonCommand LabelTitle="Laps: " />
                                    </r:RibbonTextBox.Command>
                                </r:RibbonTextBox>
                            </r:RibbonGroup>

                        </r:RibbonTab>
                    </r:RibbonContextualTabGroup>

                </r:Ribbon.ContextualTabGroups>

                <r:RibbonTab Label="Main">
                    <r:RibbonGroup>
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="New game" />
                        </r:RibbonGroup.Command>
                        <r:RibbonDropDownButton Command="{StaticResource StartQuickGameCommand}">
                            <r:RibbonMenuItem Command="{StaticResource StartLocalGameCommand}" />
                            <r:RibbonMenuItem Command="{StaticResource StartNetGameCommand}" />
                        </r:RibbonDropDownButton>
                        <r:RibbonButton Command="{StaticResource StartTutorialGameCommand}" />
                    </r:RibbonGroup>

                    <r:RibbonGroup>
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Other" />
                        </r:RibbonGroup.Command>

                        <r:RibbonButton Command="{StaticResource StartTrackEditorCommand}" />
                        <r:RibbonButton Command="{StaticResource ShowInstructionsCommand}" />
                    </r:RibbonGroup>
                </r:RibbonTab>

            </r:Ribbon>
            <Frame NavigationUIVisibility="Hidden" Source="{Binding Source={x:Static local:Business.Instance}, Path=Page}" />

        </DockPanel>
        
    </Grid>
</r:RibbonWindow>
